<template>
	<view class="bg-white p-20">
		<view class="text-2xl u-text-center font-bold">欢迎登录</view>
		<view>
			<u-form :model="form" ref="uForm" label-width="200" :border-bottom="true" class="mx-10">
				<u-form-item label="登录帐号">
					<u-input v-model="form.mobile" placeholder="请输入邮箱或手机号" />
				</u-form-item>
				<u-form-item label="登录密码">
					<u-input v-model="form.password" type="password" placeholder="请输入登录密码" />
				</u-form-item>
			</u-form>

			<view class="flex mt-30 justify-center">
				<u-button type="success" @click="submit" class="mx-10 w-full" style="display: inline-block;">
					登录
				</u-button>
			</view>
			<view class="flex mt-30 justify-end mr-20">
				<text class="mr-40" @click="register">没有账号,立即注册</text>
				<text @click="forget">忘记密码</text>
			</view>

		</view>
	</view>
</template>

<script>
	import {
		mapActions,
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				form: {
					mobile: 18090900235,
					password: 'admin888',
				}
			}
		},
		methods: {
			...mapActions('user', ['login']),

			submit() {
				this.login(this.form).then(_ => {
					console.log('ok')
					uni.reLaunch({
						url: "/pages/index/index"
					})
				})
			},
			register() {
				uni.navigateTo({
					url: '../register/register'
				})
			},
			forget() {
				console.log(33)
				uni.navigateTo({
					url: '/pages/my/forget/forget'
				})
			}
		}
	}
</script>

<style>

</style>
